<?php
/**

 */
namespace app\admin\controller\system;

use core\basic\Controller;
use app\admin\model\system\SyslogModel;
use app\admin\model\system\BlacklogModel;
class BlacklogController extends Controller
{

    private $model;

    public function __construct()
    {
        $this->model = new BlacklogModel();
    }

    // 日志列表
    public function index()
    {
        $this->assign('syslogs', $this->model->getList());
        $this->display('system/blacklog.html');
    }
    function toblack(){
        $id = get('id');
        if ($this->model->toBlack($id)) {
            success('操作成功！', - 1);
        } else {
            error('操作失败！', - 1);
        }
    }
    // 清理日志
    public function clear()
    {
        if ($this->model->clearLog()) {
            alert_location('清空成功！', url('/admin/Blacklog/index'));
        } else {
            alert_location('清空失败！', url('/admin/Blacklog/index'));
        }
    }
}